package com.ruoyi.web.controller.control;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.control.domain.Electricity;
import com.ruoyi.control.dto.*;
import com.ruoyi.control.service.IElectricityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 电力实时Controller
 * 
 * @author ruoyi
 * @date 2024-11-09
 */
@RestController
@RequestMapping("/control/electricity")
public class ElectricityController extends BaseController
{
    @Autowired
    private IElectricityService electricityService;

    /**
     * 查询电力实时列表
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/list")
    public TableDataInfo list(Electricity electricity)
    {
        startPage();
        List<Electricity> list = electricityService.selectElectricityList(electricity);
        return getDataTable(list);
    }

    /**
     * lqx
     * 查询电力实时列表 - 不分页
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listWithOutPage")
    public List<Electricity> listWithOutPage(Electricity electricity)
    {
        List<Electricity> list = electricityService.selectElectricityList(electricity);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所-遥测+遥信 - chReal)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listCHGroundElectricityDto")
    public List<CHGroundElectricityDto> listCHGroundElectricityDto()
    {
        List<CHGroundElectricityDto> list = electricityService.selectCHGroundElectricityDtoList();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所新增-遥测+遥信 - chReal)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listCHGroundNewElectricityDto")
    public List<CHGroundNewElectricityDto> listCHGroundNewElectricityDto()
    {
        List<CHGroundNewElectricityDto> list = electricityService.selectCHGroundNewElectricityDtoList();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下变电所高压-遥测+遥信 - chReal)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listCHUnderGroundHElectricityDto")
    public List<CHUnderGroundHElectricityDto> listCHUnderGroundHElectricityDto()
    {
        List<CHUnderGroundHElectricityDto> list = electricityService.selectCHUnderGroundHElectricityDtoList();
        return list;
    }
    /**
     * lqx
     * 查询电力实时列表(地下变电所低压-遥测+遥信 - chReal)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listCHUnderGroundLElectricityDto")
    public List<CHUnderGroundLElectricityDto> listCHUnderGroundLElectricityDto()
    {
        List<CHUnderGroundLElectricityDto> list = electricityService.selectCHUnderGroundLElectricityDtoList();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所-遥测+遥信 - ch)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listGroundElectricityDto")
    public List<GroundElectricityDto> listGroundElectricityDto()
    {
        List<GroundElectricityDto> list = electricityService.selectGroundElectricityDtoList();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下变电所高压-遥测+遥信 - ch)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundHElectricityDto")
    public List<UnderGroundHElectricityDto> listUnderGroundHElectricityDto()
    {
        List<UnderGroundHElectricityDto> list = electricityService.selectUnderGroundHElectricityDtoList();
        return list;
    }
    /**
     * lqx
     * 查询电力实时列表(地下变电所低压-遥测+遥信 - ch)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundLElectricityDto")
    public List<UnderGroundLElectricityDto> listUnderGroundLElectricityDto()
    {
        List<UnderGroundLElectricityDto> list = electricityService.selectUnderGroundLElectricityDtoList();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所-遥测+遥信)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listGroundSubstationAll")
    public List<ElectricityDto> listGroundSubstationAll()
    {
        List<ElectricityDto> list = electricityService.selectGroundSubstationList();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下高压变电所-遥测)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundSubstationH")
    public List<ElectricityUnderHDto> listUnderGroundSubstationH()
    {
        List<ElectricityUnderHDto> list = electricityService.listUnderGroundSubstationH();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下低压变电所-遥测)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundSubstationL")
    public List<ElectricityUnderLDto> listUnderGroundSubstationL()
    {
        List<ElectricityUnderLDto> list = electricityService.listUnderGroundSubstationL();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所-状态5_0)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listGroundSubstationStatus5_0")
    public List<Electricity> listGroundSubstationStatus5_0()
    {
        List<Electricity> list = electricityService.listGroundSubstationStatus5_0();
        return list;
    }
    /**
     * lqx
     * 查询电力实时列表(地下变电所-状态5_0)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundSubstationStatus5_0")
    public List<Electricity> listUnderGroundSubstationStatus5_0()
    {
        List<Electricity> list = electricityService.listUnderGroundSubstationStatus5_0();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所-状态0_0)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listGroundSubstationStatus0_0")
    public List<Electricity> listGroundSubstationStatus0_0()
    {
        List<Electricity> list = electricityService.listGroundSubstationStatus0_0();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下变电所H1-状态0_1)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundSubstationH1Status0_1")
    public List<Electricity> listUnderGroundSubstationH1Status0_1()
    {
        List<Electricity> list = electricityService.listUnderGroundSubstationH1Status0_1();
        return list;
    }
    /**
     * lqx
     * 查询电力实时列表(地下变电所H2-状态1_6)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundSubstationH2Status1_6")
    public List<Electricity> listUnderGroundSubstationH2Status1_6()
    {
        List<Electricity> list = electricityService.listUnderGroundSubstationH2Status1_6();
        return list;
    }
    /**
     * lqx
     * 查询电力实时列表(地下变电所L1-状态2_1)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUnderGroundSubstationL1Status2_1")
    public List<Electricity> listUnderGroundSubstationL1Status2_1()
    {
        List<Electricity> list = electricityService.listUnderGroundSubstationL1Status2_1();
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所-遥测)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listGroundSubstationTelemetry/{tagName}")
    public List<Electricity> listGroundSubstationTelemetry(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectGroundSubstationTelemetryList(tagName);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地面变电所-遥信)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listGroundSubstationSignaling/{tagName}")
    public List<Electricity> listGroundSubstationSignaling(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectGroundSubstationSignalingList(tagName);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下高压变电所1-遥测)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUndergroundSubstationH1Telemetry/{tagName}")
    public List<Electricity> listUndergroundSubstationH1Telemetry(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectUndergroundSubstationH1TelemetryList(tagName);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下高压变电所1-遥信)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUndergroundSubstationH1Signaling/{tagName}")
    public List<Electricity> listUndergroundSubstationH1Signaling(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectGroundSubstationSignalingList(tagName);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下高压变电所2-遥测)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUndergroundSubstationH2Telemetry/{tagName}")
    public List<Electricity> listUndergroundSubstationH2Telemetry(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectUndergroundSubstationH2TelemetryList(tagName);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下高压变电所2-遥信)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUndergroundSubstationH2Signaling/{tagName}")
    public List<Electricity> listUndergroundSubstationH2Signaling(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectGroundSubstationSignalingList(tagName);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下低压变电所1-遥测)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUndergroundSubstationL1Telemetry/{tagName}")
    public List<Electricity> listUndergroundSubstationL1Telemetry(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectUndergroundSubstationH1TelemetryList(tagName);
        return list;
    }

    /**
     * lqx
     * 查询电力实时列表(地下低压变电所1-遥信)
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:list')")
    @GetMapping("/listUndergroundSubstationL1Signaling/{tagName}")
    public List<Electricity> listUndergroundSubstationL1Signaling(@PathVariable("tagName") String tagName)
    {
        List<Electricity> list = electricityService.selectGroundSubstationSignalingList(tagName);
        return list;
    }

    /**
     * 导出电力实时列表
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:export')")
    @Log(title = "电力实时", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Electricity electricity)
    {
        List<Electricity> list = electricityService.selectElectricityList(electricity);
        ExcelUtil<Electricity> util = new ExcelUtil<Electricity>(Electricity.class);
        util.exportExcel(response, list, "电力实时数据");
    }

    /**
     * 获取电力实时详细信息
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:query')")
    @GetMapping(value = "/{tagName}")
    public AjaxResult getInfo(@PathVariable("tagName") String tagName)
    {
        return success(electricityService.selectElectricityByTagName(tagName));
    }

    /**
     * 新增电力实时
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:add')")
    @Log(title = "电力实时", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Electricity electricity)
    {
        return toAjax(electricityService.insertElectricity(electricity));
    }

    /**
     * 修改电力实时
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:edit')")
    @Log(title = "电力实时", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Electricity electricity)
    {
        return toAjax(electricityService.updateElectricity(electricity));
    }

    /**
     * 删除电力实时
     */
    @PreAuthorize("@ss.hasPermi('control:electricity:remove')")
    @Log(title = "电力实时", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tagNames}")
    public AjaxResult remove(@PathVariable String[] tagNames)
    {
        return toAjax(electricityService.deleteElectricityByTagNames(tagNames));
    }
}
